<template>
  <div id="app">
    <router-view/>
  </div>
</template>
<script>
  import axios from "@/axios";
  import store from "@/store";
  import router from "@/router";

  export default {
    name: "App",
    data() {
      return {
        msg: '鸿蒙1',
        username: 'admin',
        info: {
          username: 'admin'
        }
      }
    },
    computed: {

    },
    filters: {
      reversMsg: function (value) {
        if (value == '鸿蒙') {
          return value.split('').reverse().join('');
        } else {
          return value;
        }
      }
    },
    watch: {

      // 解决刷新浏览器没有tab的问题
      $route(to, from) {
        if (to.path != '/login') {
          let obj = {
            name: to.name,
            title: to.meta.title
          }
          this.$store.commit("addTab", obj)
        }
      }
    },
    created() {
      console.log(process.env)
      this.$store.dispatch("testStore", "hello harmony")

      // 设置菜单和权限
      this.$store.commit("setPermission",this.$router);
      this.$store.commit("setUserInfo");

    },
    mounted() {
      console.log(this.querySelector("#app"))
      console.log(document.querySelector("#app"))
    }
  }
</script>
<style>
  html, body, #app {
    margin: 0;
    padding: 0;
    height: 100vh;
  }
</style>
